﻿namespace ExamV5.WorkExam
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmShowRubricInfo : Page
    {
        protected Button butClose;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private int int_0 = 0;
        protected Label labEditTime;
        protected Label labEditUser;
        protected Label labIsDel;
        protected Label labOKAnswer;
        protected Label labOptionAnswer;
        protected Label labRubricDoc;
        protected Label labSubjectName;
        private PublicFun publicFun_0 = new PublicFun();

        private void method_0()
        {
            try
            {
                string str = "";
                string str2 = "";
                string str3 = "";
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                connection.Open();
                str = "select a.IsDel,b.SubjectName,c.UserName,a.RubricType,a.RubricTitle,a.OptionAnswer,a.OKAnswer,a.CreatTime ";
                SqlCommand command = new SqlCommand(str + " from WorkRubric a,SubjectInfo b,UserInfo c where a.SubjectID=b.ID and c.UserCode=a.CreatNumberNO and a.ID=" + this.int_0, connection);
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                if (reader.Read())
                {
                    if (reader["IsDel"].ToString() == "N")
                    {
                        this.labIsDel.Text = "正常使用";
                    }
                    else
                    {
                        this.labIsDel.Text = "禁止使用";
                    }
                    str2 = reader["OptionAnswer"].ToString();
                    str3 = reader["OKAnswer"].ToString();
                    this.labSubjectName.Text = reader["SubjectName"].ToString();
                    string str5 = reader["RubricType"].ToString();
                    if ((str5 != null) && (str5 == "A"))
                    {
                        string[] strArray = str2.Split(new char[] { '#' });
                        string[] strArray2 = str3.Split(new char[] { '#' });
                        for (int i = 0; i < strArray.Length; i++)
                        {
                            if (strArray[i].ToString() != "")
                            {
                                this.labOptionAnswer.Text = this.labOptionAnswer.Text + "<br>";
                                this.labOKAnswer.Text = this.labOKAnswer.Text + "<br>";
                                switch (i)
                                {
                                    case 0:
                                        this.labOptionAnswer.Text = this.labOptionAnswer.Text + "A、" + strArray[i].ToString();
                                        this.labOKAnswer.Text = this.labOKAnswer.Text + "A、" + strArray2[i].ToString();
                                        break;

                                    case 1:
                                        this.labOptionAnswer.Text = this.labOptionAnswer.Text + "B、" + strArray[i].ToString();
                                        this.labOKAnswer.Text = this.labOKAnswer.Text + "B、" + strArray2[i].ToString();
                                        break;

                                    case 2:
                                        this.labOptionAnswer.Text = this.labOptionAnswer.Text + "C、" + strArray[i].ToString();
                                        this.labOKAnswer.Text = this.labOKAnswer.Text + "C、" + strArray2[i].ToString();
                                        break;

                                    case 3:
                                        this.labOptionAnswer.Text = this.labOptionAnswer.Text + "D、" + strArray[i].ToString();
                                        this.labOKAnswer.Text = this.labOKAnswer.Text + "D、" + strArray2[i].ToString();
                                        break;

                                    case 4:
                                        this.labOptionAnswer.Text = this.labOptionAnswer.Text + "E、" + strArray[i].ToString();
                                        this.labOKAnswer.Text = this.labOKAnswer.Text + "E、" + strArray2[i].ToString();
                                        break;

                                    case 5:
                                        this.labOptionAnswer.Text = this.labOptionAnswer.Text + "F、" + strArray[i].ToString();
                                        this.labOKAnswer.Text = this.labOKAnswer.Text + "F、" + strArray2[i].ToString();
                                        break;
                                }
                            }
                        }
                    }
                    this.labRubricDoc.Text = reader["RubricTitle"].ToString();
                    this.labEditUser.Text = reader["UserName"].ToString();
                    this.labEditTime.Text = reader["CreatTime"].ToString();
                }
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            catch
            {
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            this.int_0 = Convert.ToInt32(base.Request["ID"].ToString());
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                if (!base.IsPostBack)
                {
                    if (!(this.publicFun_0.ReturnPaperData() != "Yes"))
                    {
                        if (!((this.int_0 != 0) ? !(this.httpCookie_2.Value != "A") : true))
                        {
                            this.method_0();
                        }
                    }
                    else
                    {
                        base.Response.Write("<script>alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')</script>");
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

